// Gumby is ready to go
Gumby.ready(function() {
	

	// placeholder polyfil
	if(Gumby.isOldie || Gumby.$dom.find('html').hasClass('ie9')) {
		$('input, textarea').placeholder();
	}
});

// Oldie document loaded
Gumby.oldie(function() {
	console.log("This is an oldie browser...");
});

// Touch devices loaded
Gumby.touch(function() {
	console.log("This is a touch enabled device...");
});

 
this.imagePreview = function(){	
	/* CONFIG */
		
		xOffset = 10;
		yOffset = 30;
		
		// these 2 variable determine popup's distance from the cursor
		// you might want to adjust to get the right result
		
	/* END CONFIG */
	$("a.preview").hover(function(e){
		this.t = this.title;
		this.title = "";	
		var c = (this.t != "") ? "<br/>" + this.t : "";
		$("body").append("<p id='preview'><img src='"+ this.href +"' alt='Image preview' />"+ c +"</p>");								 
		$("#preview")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.fadeIn("fast");						
    },
	function(){
		this.title = this.t;	
		$("#preview").remove();
    });	
	$("a.preview").mousemove(function(e){
		$("#preview")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});			
};




// Document ready
$(function ()
{
    $('.scrollspy-data-topHotel').scrollspy();
    $('.btnSearch')
      .click(function ()
      {
          var btn = $(this)
          btn.button('loading')
          setTimeout(function ()
          {
              btn.button('reset')
          }, 3000)
      });

    $(':checkbox').change(function () {
       
    });

    //---------------

    $('#polyglotLanguageSwitcher').polyglotLanguageSwitcher({
        effect: 'fade',
        testMode: false
        //onChange: function(evt){
        //  alert("The selected language is: "+evt.selectedItem);
        //}
        //                ,afterLoad: function(evt){
        //                    alert("The selected language has been loaded");
        //                },
        //                beforeOpen: function(evt){
        //                    alert("before open");
        //                },
        //                afterOpen: function(evt){
        //                    alert("after open");
        //                },
        //                beforeClose: function(evt){
        //                    alert("before close");
        //                },
        //                afterClose: function(evt){
        //                    alert("after close");
        //                }
    });

    imagePreview();

    $('#InformationForm').validation(
    {
        required: [
        {
            name: 'lastname'
        }
        ],
        fail: function(failed)
        {
            alert('please filll out')
        }
            
    });
});

 $('.checkIn').datepicker();

 $('.checkOut').datepicker();

 $('#myCarousel').carousel();